package com.twq.oo.hierarchy

/**
 * Created by tangweiqun on 2017/11/28.
 */
object ValueClassDef {
  def main(args: Array[String]): Unit = {
    val money = new Dollars(1000000)
    println(money.amount)

    val dollars = new Dollars(1000)
    val francs = new SwissFrancs(1000)
  }
}

class Dollars(val amount: Int) extends AnyVal {
  override def toString() = "$" + amount
}

class SwissFrancs(val amount: Int) extends AnyVal {
  override def toString() = amount + " CHF"
}
